package com.example.frank.login.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.example.frank.login.R;

/**
 * Created by Administrator on 2018/5/16.
 */
    public class Fragment1 extends Fragment {

        @Override
        public void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method
            super.onCreate(savedInstanceState);

        }

        @SuppressLint("InflateParams")
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            // TODO Auto-generated method stub

            View view = inflater.inflate(R.layout.fragment1, null);
            WebView webview = view.findViewById(R.id.wv_f1);
            //webview.loadUrl("http://www.baidu.com");
            webview.loadUrl("file:///android_asset/index.html");
            //支持App内部javascript交互
            webview.getSettings().setJavaScriptEnabled(true);
            //自适应屏幕
            webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
            webview.getSettings().setLoadWithOverviewMode(true);
            //设置是否出现缩放工具
            webview.getSettings().setBuiltInZoomControls(true);
            //设置可以支持缩放
            webview.getSettings().setSupportZoom(true);
            //扩大比例的缩放
            webview.getSettings().setUseWideViewPort(true);

            return view;
        }
    }

